class Solution(object):
    def rob(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """
        nums_len = len(nums)
        fn_2 = nums[0]
        if nums_len == 1:
            return fn_2
        if nums[1] > fn_2:
            fn_1 = nums[1]
        else:
            fn_1 = fn_2
        for i in range(2, nums_len):
            tmp = nums[i] + fn_2
            fn_2 =  fn_1
            if tmp > fn_1:
                fn_1 = tmp
        return fn_1
